package com.touhou.youmu.mapper

import org.apache.ibatis.annotations.Delete
import org.apache.ibatis.annotations.Insert
import org.apache.ibatis.annotations.Select
import org.apache.ibatis.annotations.Update


interface ApiMapper {

    @Insert("INSERT INTO sys_user(id,username,password) VALUES(#{id}, #{username}, #{password})")
    fun addTest(map: Map<String, String>):Int

    @Select("select * from sys_user where username = #{username} and password = #{password}")
    fun loginUser(map: Map<String, String>):List<Map<String,String>>

    @Update("update sys_book  set  bookname = #{bookname},bookcb = #{bookcb},bookzz = #{bookzz},bookimg = #{bookimg} where id = #{id}")
    fun updatebook(map: Map<String, String>):Int

    @Update("update sys_user  set  jf = #{jf} where id = #{id}")
    fun updatejf(map: Map<String, String>):Int

    @Select("select * from sys_user where huida = #{huida} and wenti = #{wenti}")
    fun findPassword(map: Map<String, String>):List<Map<String,String>>

    @Select("select * from sys_book ")
    fun slectys():List<Map<String,String>>

    @Select("select * from sys_book where bookname like '%\${bookname}%'")
    fun slectsssj(map: Map<String, String>):List<Map<String,String>>

    @Select("select * from sys_book where upid = #{uid}")
    fun slectsssj2(map: Map<String, String>):List<Map<String,String>>

    @Insert("INSERT INTO sys_book(id,upid,bookimg,bookname,bookcb,bookzz) VALUES(#{id}, #{upid},#{bookimg},#{bookname},#{bookcb},#{bookzz})")
    fun saveYSXX(map: Map<String, String>):Int

    @Delete("DELETE FROM sys_book WHERE id  = #{id}")
    fun deletSJ(map: Map<String, String>):Int


}